﻿/// <reference path="jquery-1.7.2.min.js" />

$(document).ready(function () {

    $("#BuyerId").change(function () {
        var buyerId = $(this).val();
        $.getJSON('/Dpr/GetSelectedStyle', { id: buyerId },

            function (carData) {
                var select = $("#StyleId");
                select.empty();

                select.append($('<option/>', {
                    value: "",
                    text: ""
                }));

                $.each(carData, function (index, itemData) {
                    select.append($('<option/>', {
                        value: itemData.Value,
                        text: itemData.Text
                    }));
                });
            });
    });

    $("#StyleId").change(function () {
        var styleId = $(this).val();
        $.getJSON('/Dpr/GetSelectedPo', { id: styleId },
            function (carData) {
                var select = $("#PoStyleId");
                select.empty();

                select.append($('<option/>', {
                    value: "",
                    text: ""
                }));

                $.each(carData, function (index, itemData) {
                    select.append($('<option/>', {
                        value: itemData.Value,
                        text: itemData.Text
                    }));
                });
            });
    });

//    $("#PoStyleId").change(function () {
//        var poStyleId = $(this).val();
//        $.getJSON('GetOrderQuantity', { id: poStyleId },
//            function (carData) {
//                $.each(carData, function (index, itemData) {
//                    $("#OrderQuantity").val(itemData.OrderQuantity);
//                });
//            });
//    });


    $("#Floor").change(function () {
        var floorId = $(this).val();
        $.getJSON("/Dpr/GetSelectedLine", { id: floorId },
            function (carData) {
                var select = $("#FloorLineId");
                select.empty();

                select.append($('<option/>', {
                    value: "",
                    text: ""
                }));

                $.each(carData, function (index, itemData) {
                    select.append($('<option/>', {
                        value: itemData.Value,
                        text: itemData.Text
                    }));
                });
            });
    });

//    $("#Line").change(function () {
//        var date = $("#Date").val();
//        var floor = $("#Floor").val();
//        var line = $(this).val();
//        var poId = $("#PoStyleId").val();

//        $("#cutting").attr('placeholder', "");
//        $("#SentPrintEmb").attr('placeholder', "");
//        $("#ReceivedPrintEmb").attr('placeholder', "");
//        $("#SewingInput").attr('placeholder', "");
//        $("#TodaySewing").attr('placeholder', "");
//        $("#SentWash").attr('placeholder', "");
//        $("#ReceivedWash").attr('placeholder', "");
//        $("#TodayFinish").attr('placeholder', "");

//        $.getJSON('@Url.Action("GetValue")', { id: poId, date: date, floor: floor, line: line },
//            function (carData) {
//                $.each(carData, function (index, itemData) {

//                    $("#cutting").attr('placeholder', itemData.cutting);
//                    $("#SentPrintEmb").attr('placeholder', itemData.SentPrintEmb);
//                    $("#ReceivedPrintEmb").attr('placeholder', itemData.ReceivedPrintEmb);
//                    $("#SewingInput").attr('placeholder', itemData.SewingInput);
//                    $("#TodaySewing").attr('placeholder', itemData.TodaySewing);
//                    $("#SentWash").attr('placeholder', itemData.SentWash);
//                    $("#ReceivedWash").attr('placeholder', itemData.ReceivedWash);
//                    $("#TodayFinish").attr('placeholder', itemData.TodayFinish);
//                });
//            });
//    });
});